CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
INCLUDE(../../cmake/toolchain.cmake)

# include
INCLUDE_DIRECTORIES(./include)
INCLUDE_DIRECTORIES(./include/opus)
INCLUDE_DIRECTORIES(./src)
INCLUDE_DIRECTORIES(./src/celt)
INCLUDE_DIRECTORIES(./src/silk)
INCLUDE_DIRECTORIES(./src/silk/float)
INCLUDE_DIRECTORIES(./src/silk/fixed)

SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function")

ADD_DEFINITIONS(
    -DHAVE_CONFIG_H
    -DFIXED_POINT
    -DOPUS_CSKY_ASM
)

SET(LIBSOURCE 
	src/celt/bands.c
	src/celt/celt.c
	src/celt/celt_encoder.c
	src/celt/celt_decoder.c
	src/celt/cwrs.c
	src/celt/entcode.c
	src/celt/entdec.c
	src/celt/entenc.c
	src/celt/kiss_fft.c
	src/celt/laplace.c
	src/celt/mathops.c
	src/celt/mdct.c
	src/celt/modes.c
	src/celt/pitch.c
	src/celt/celt_lpc.c
	src/celt/quant_bands.c
	src/celt/rate.c
	src/celt/vq.c
	src/silk/CNG.c
	src/silk/code_signs.c
	src/silk/init_decoder.c
	src/silk/decode_core.c
	src/silk/decode_frame.c
	src/silk/decode_parameters.c
	src/silk/decode_indices.c
	src/silk/decode_pulses.c
	src/silk/decoder_set_fs.c
	src/silk/dec_API.c
	src/silk/enc_API.c
	src/silk/encode_indices.c
	src/silk/encode_pulses.c
	src/silk/gain_quant.c
	src/silk/interpolate.c
	src/silk/LP_variable_cutoff.c
	src/silk/NLSF_decode.c
	src/silk/NSQ.c
	src/silk/NSQ_del_dec.c
	src/silk/PLC.c
	src/silk/shell_coder.c
	src/silk/tables_gain.c
	src/silk/tables_LTP.c
	src/silk/tables_NLSF_CB_NB_MB.c
	src/silk/tables_NLSF_CB_WB.c
	src/silk/tables_other.c
	src/silk/tables_pitch_lag.c
	src/silk/tables_pulses_per_block.c
	src/silk/VAD.c
	src/silk/control_audio_bandwidth.c
	src/silk/quant_LTP_gains.c
	src/silk/VQ_WMat_EC.c
	src/silk/HP_variable_cutoff.c
	src/silk/NLSF_encode.c
	src/silk/NLSF_VQ.c
	src/silk/NLSF_unpack.c
	src/silk/NLSF_del_dec_quant.c
	src/silk/process_NLSFs.c
	src/silk/stereo_LR_to_MS.c
	src/silk/stereo_MS_to_LR.c
	src/silk/check_control_input.c
	src/silk/control_SNR.c
	src/silk/init_encoder.c
	src/silk/control_codec.c
	src/silk/A2NLSF.c
	src/silk/ana_filt_bank_1.c
	src/silk/biquad_alt.c
	src/silk/bwexpander_32.c
	src/silk/bwexpander.c
	src/silk/debug.c
	src/silk/decode_pitch.c
	src/silk/inner_prod_aligned.c
	src/silk/lin2log.c
	src/silk/log2lin.c
	src/silk/LPC_analysis_filter.c
	src/silk/LPC_inv_pred_gain.c
	src/silk/table_LSF_cos.c
	src/silk/NLSF2A.c
	src/silk/NLSF_stabilize.c
	src/silk/NLSF_VQ_weights_laroia.c
	src/silk/pitch_est_tables.c
	src/silk/resampler.c
	src/silk/resampler_down2_3.c
	src/silk/resampler_down2.c
	src/silk/resampler_private_AR2.c
	src/silk/resampler_private_down_FIR.c
	src/silk/resampler_private_IIR_FIR.c
	src/silk/resampler_private_up2_HQ.c
	src/silk/resampler_rom.c
	src/silk/sigm_Q15.c
	src/silk/sort.c
	src/silk/sum_sqr_shift.c
	src/silk/stereo_decode_pred.c
	src/silk/stereo_encode_pred.c
	src/silk/stereo_find_predictor.c
	src/silk/stereo_quant_pred.c
	src/silk/LPC_fit.c
	src/src/opus.c
	src/src/opus_decoder.c
	src/src/opus_encoder.c
	src/src/opus_multistream.c
	src/src/opus_multistream_encoder.c
	src/src/opus_multistream_decoder.c
	src/src/repacketizer.c
	src/src/opus_projection_encoder.c
	src/src/opus_projection_decoder.c
	src/src/mapping_matrix.c
	src/src/analysis.c
	src/src/mlp.c
	src/src/mlp_data.c
	src/silk/fixed/LTP_analysis_filter_FIX.c
	src/silk/fixed/LTP_scale_ctrl_FIX.c
	src/silk/fixed/corrMatrix_FIX.c
	src/silk/fixed/encode_frame_FIX.c
	src/silk/fixed/find_LPC_FIX.c
	src/silk/fixed/find_LTP_FIX.c
	src/silk/fixed/find_pitch_lags_FIX.c
	src/silk/fixed/find_pred_coefs_FIX.c
	src/silk/fixed/noise_shape_analysis_FIX.c
	src/silk/fixed/process_gains_FIX.c
	src/silk/fixed/regularize_correlations_FIX.c
	src/silk/fixed/residual_energy16_FIX.c
	src/silk/fixed/residual_energy_FIX.c
	src/silk/fixed/warped_autocorrelation_FIX.c
	src/silk/fixed/apply_sine_window_FIX.c
	src/silk/fixed/autocorr_FIX.c
	src/silk/fixed/burg_modified_FIX.c
	src/silk/fixed/k2a_FIX.c
	src/silk/fixed/k2a_Q16_FIX.c
	src/silk/fixed/pitch_analysis_core_FIX.c
	src/silk/fixed/vector_ops_FIX.c
	src/silk/fixed/schur64_FIX.c
	src/silk/fixed/schur_FIX.c
)

ADD_LIBRARY(opus ${LIBSOURCE})

INSTALL(TARGETS opus DESTINATION ${INSTALL_PATH}/lib)
INSTALL(DIRECTORY ./include DESTINATION ${INSTALL_PATH}/include)


